/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.cloudfarming.client.sensor;

import java.text.ParseException;
import java.util.Date;
import java.util.List;
import nl.cloudfarming.sensor.model.GeoSensorDataBO;
import nl.cloudfarming.sensor.model.GeoSensorDataFileBO;
import nl.cloudfarming.sensor.model.PlotBO;
import nl.cloudfarming.sensor.model.PlotDataFileBO;
import nl.cloudfarming.sensor.model.SensorMetadataBO;
import nl.cloudfarming.sensor.model.SensorRunBO;

/**
 * @author Timon Veenstra
 */
public interface SensorService {

    void persist(GeoSensorDataBO geoSensorDataBO);

    void persist(SensorRunBO sensorRunBO);

    /**
     * bulk persist a list of GeoSensorDataBO
     *
     * @param sensorDataList
     */
    void bulkPersist(List<GeoSensorDataBO> sensorDataList);

    void persist(GeoSensorDataFileBO geoSensorDataFileBO);

    void persist(SensorMetadataBO sensorMetaDataBO);

    void persist(PlotBO plotBO);

    void persist(PlotDataFileBO plotDataFileBO);

    void updateSensorMetadata(GeoSensorDataFileBO sensorDataFileBO, SensorMetadataBO newSensorMetadataBO);

    List<GeoSensorDataBO> findAllGeoSensorData();

    List<GeoSensorDataFileBO> findAllGeoSensorDataFiles();

    List<GeoSensorDataBO> findAllGeoSensorDataNoSensorRun();

    List<SensorMetadataBO> findAllSensorMetaData();

    List<PlotBO> findAllPlotData();

    List<PlotDataFileBO> findAllPlotDataFiles();

    GeoSensorDataBO findGeoSensorDataBOById(long id);

    SensorMetadataBO findSensorMetaDataBOById(long id);

    SensorMetadataBO findSensorMetaDataBOByMetadata(String dateFormat, int sensorHeight);

    GeoSensorDataFileBO findGeoSensorDataFileByNameChecksum(String fileName, String checksum);

    PlotDataFileBO findPlotDataFileByNameChecksum(String fileName, String checksum);

    void persistGeoSensorDataBOList(List <GeoSensorDataBO> unit);

    void persistPlotBOList(List <PlotBO> unit);

    List<SensorRunBO> findSensorRunsByPeriod(Date dateFrom, Date dateUntil);

    List<SensorRunBO> findAllSensorRuns();

    SensorRunBO findSensorRunBO(GeoSensorDataFileBO geoDataSensorFile, PlotBO bo);

    //
    List<GeoSensorDataBO> findSensorDataForRun(SensorRunBO sensorRunBO);

    /**
     * find all sensor runs for a plot
     * 
     * @param plotBO
     * @return
     */
    List<SensorRunBO> findSensorRunsForPlot(PlotBO plotBO);

    /**
     * find all sensor runs for a plot id
     * 
     * @param plotId
     * @return
     */
    List<SensorRunBO> findSensorRunsForPlotId(Long plotId);


    List<PlotBO> findPlotsForYear(int year) throws ParseException;

}
